<?php include 'auth.php'; ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="Content-Language" content="en" />
	<meta name="GENERATOR" content="PHPEclipse 1.2.0" />
	<link href="css/paginas.css" rel="stylesheet" type="text/css" />
	<link href="css/videos.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="fundo_paginas">
		<div id="geral_paginas">
		
			<?php
				 include 'menu.php';
				 include 'conexao.php';
			?>
			
			<div id="conteudo">
				<div id="titulo_pg">Videos</div>
				<?php
					if(@$_GET['funcao']!="alterar"){
				?>
				<div id="videos_adm">
					<form action="funcao_videos.php?funcao=gravar" method="post">
						<label id="texto_video">Texto:</label><textarea name="texto_video" rows="7" cols="50" ></textarea>
						<label id="video_link">Video:</label><input type="text" id="link_video" name="link_video" size="67" />
						<br /><input type="submit" id="enviar_video" name="enviar_video" value="Salvar" />
					</form>
					<hr />
					<h2>Alterar / Excluir</h2>
					<?php
						$sql = mysql_query("select * from videos");
						while($linha = mysql_fetch_array($sql)){
							$texto = $linha['texto'];
							$video = $linha['video'];
							$id = $linha['id'];
					?>
					<div id="videos">
						<iframe width="200" height="150" src="<?=$video?>" frameborder="0" allowfullscreen></iframe>
						<a href="index.php?pg=videos&funcao=alterar&id=<?=$id?>" ><strong>Alterar</strong></a> | 
						<a href="funcao_videos.php?funcao=excluir&id=<?=$id?>" ><strong>Excluir</strong></a>
					</div>
					<?php 
						} //while
					}// if 
					if(@$_GET['funcao']=="alterar"){
						$id = $_GET['id'];
						$sql = mysql_query("select * from videos where id=$id");
						while($linha = mysql_fetch_array($sql)){
							$texto = $linha['texto'];
							$video = $linha['video'];
						}
					?>
					<div id="videos_adm">
						<form action="funcao_videos.php?funcao=alterar&id=<?=$id?>" method="post">
							<label id="texto_video">Texto:</label><textarea name="texto_video" rows="7" cols="50" ><?=$texto?></textarea>
							<label id="video_link">Video:</label><input type="text" id="link_video" name="link_video" size="67" value="<?=$video?>" />
							<br /><input type="submit" id="enviar_video" name="enviar_video" value="Salvar" />
						</form>
						<center><p><a href="javascript:history.back()">Voltar</a></p></center>
					</div>
					<?php
					}
					?>
				</div>	
			</div><!--conteudo-->
			<div style="clear:both;"></div>
		</div><!--geral paginas-->
	</div><!--fundo paginas-->
</body>
</html>